package com.weaver.qfengx;

import com.weaver.qfengx.id.SnowFlake;

import java.util.UUID;

/**
 * ID生成工具类
 * Created by YeShengtao on 2020/9/21 19:58
 */
public class IDUtils {

    private static SnowFlake snowFlake = new SnowFlake();

    public static String uuid() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    public static String snowFlakeId() {
        return Long.toString(snowFlake.nextId());
    }

    public static String id() {
        return DateUtils.date("yyyyMMddHHmmss") + StringUtils.tailSubstring(DateUtils.timestamp(), 5);
    }

}
